package com.example.activity.repository;

import com.example.activity.ActivityInstance;
import org.springframework.stereotype.Repository;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author Houger.
 * @date 2024年12月17日 16:23.
 */
@Repository
public class InstanceRepository {


    private static final Map<String,ActivityInstance> instanceMap = new ConcurrentHashMap<>();
    public ActivityInstance getInstance(String instanceId) {
        return instanceMap.get(instanceId);
    }

    public ActivityInstance save(ActivityInstance instance) {
        return instanceMap.put(instance.getAttribute("id").toString(),instance);
    }
}
